﻿namespace ManagerClinic.CanLamSang
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using DevExpress.XtraEditors;
    using ManagerClinic.Core.Common;
    using ManagerClinic.Core.Business;
    using ManagerClinic.Modules;
    using ManagerClinic.Ultilities.Ultility;
    public partial class frmDanhSachPhieuPhauThuatThuThuat : DevExpress.XtraEditors.XtraForm
    {
        PhieuPhauThuatThuThuatDiChuyenBusiness objPhieuPTDCBusiness = new PhieuPhauThuatThuThuatDiChuyenBusiness();
        PhieuPhauThuatThuThuatDiChuyenEntity objPhieuPTDC = null;
        IList<PhieuPhauThuatThuThuatDiChuyenEntity> lstPhieuPTDC = null;
        public frmDanhSachPhieuPhauThuatThuThuat()
        {
            InitializeComponent();
        }

        private void grdDanhSachBenhNhanKhamBenh_DoubleClick(object sender, EventArgs e)
        {
            if (gvDanhSachBenhNhanKhamBenh.RowCount > 0)
            {
                frmPhieuPhauThuatThuThuat frm = new frmPhieuPhauThuatThuThuat((int)ConstantManagerClinic.StateInsertOrUpdate.Update, fcnMaPhauThuatDC());
                frm.ShowDialog();
            }
        }

        private void btnDong_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        string fcnMaPhauThuatDC()
        {
            if (gvDanhSachBenhNhanKhamBenh.RowCount > 0)
            {
                objPhieuPTDC = (PhieuPhauThuatThuThuatDiChuyenEntity)gvDanhSachBenhNhanKhamBenh.GetFocusedRow();
                return objPhieuPTDC.MaPhauThuatThuThuat;
            }
            else
                return null;
        }
        void LoadData(int trangthai)
        {
            lstPhieuPTDC = objPhieuPTDCBusiness.GetPhieuPhauThuatThuThuatDiChuyenByTrangThai(trangthai);
            if (lstPhieuPTDC != null)
                grdDanhSachBenhNhanKhamBenh.DataSource = lstPhieuPTDC;
        }

        private void radTrangThaiKhamBenh_SelectedIndexChanged(object sender, EventArgs e)
        {
            LoadData(radTrangThaiKhamBenh.SelectedIndex);
        }

        private void frmDanhSachPhieuPhauThuatThuThuat_Load(object sender, EventArgs e)
        {
            LoadData(radTrangThaiKhamBenh.SelectedIndex);
        }
    }
}